package com.example.day7;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import com.example.day7.adapter.RlvNaviAdapter;
import com.example.day7.base.BaseActivity;
import com.example.day7.bean.NaviBean;
import com.example.day7.presenter.NaviPresnter;
import com.example.day7.view.NaviView;

import java.util.ArrayList;

import butterknife.BindView;

public class NaviActivity extends BaseActivity<NaviPresnter> implements NaviView {
    @BindView(R.id.rlv)
    RecyclerView mRlv;
    private RlvNaviAdapter naviAdapter;

    @Override
    protected void initListener() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {
        mRlv.setLayoutManager(new LinearLayoutManager(this));
        final ArrayList<NaviBean.DataBean> list = new ArrayList<>();
        naviAdapter = new RlvNaviAdapter(this, list);
        mRlv.setAdapter(naviAdapter);
    }

    @Override
    protected void initPreseneter() {
        mPresenter=new NaviPresnter();
        mPresenter.getdata();
    }

    @Override
    protected int getLayout() {
        return R.layout.activity_navi;
    }

    @Override
    public void onSuccess(NaviBean data) {
        if (data != null&& data.getData() != null &&data.getData().size()>0){
            naviAdapter.addData(data.getData());
        }
    }

    @Override
    public void onFali(String error) {

    }

    @Override
    public void showToast(String str) {

    }
}
